<!--
 * @Author: ૮₍ ˙О˙₎ა
 * @Date: 2023-08-04 23:35:43
-->
<template>
  <div class="All">
    <div class="header">
      <img src="https://yanxuan.nosdn.127.net/5905098f74e04c39fa5e76ebb9ff591b.png" alt="" />
      <van-row>
        <van-col span="16">
          <div class="uInfo">
            <div class="profile">
              <img
                src="https://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png"
                alt=""
              />
            </div>
            <div class="info">
              <p class="nickname">严选1787978</p>
              <span class="level">普通用户</span>
            </div>
          </div>
        </van-col>
        <van-col span="8"><div class="qrCode"></div></van-col>
      </van-row>
    </div>

    <div class="money">
      <p>我的资产</p>
      <ul>
        <li>
          <span>￥0</span>
          余额
        </li>
        <li>
          <span>0</span>
          红包
        </li>
        <li>
          <span>0</span>
          优惠券
        </li>
        <li>
          <span>0</span>
          积分
        </li>
        <li>
          <span>0</span>
          礼品卡
        </li>
      </ul>
    </div>

    <div class="grid">
      <van-grid :column-num="3">
        <van-grid-item icon="orders-o" text="我的订单" />
        <van-grid-item icon="user-o" text="账号管理" />
        <van-grid-item icon="phone-o" text="我的手机号" />
        <van-grid-item icon="calendar-o" text="周六一起拼" />
        <van-grid-item icon="balance-pay" text="售后服务" />
        <van-grid-item icon="peer-pay" text="邀请返利" />
        <van-grid-item icon="hot-o" text="优先购" />
        <van-grid-item icon="cash-o" text="积分中心" />
        <van-grid-item icon="vip-card-o" text="会员俱乐部" />
        <van-grid-item icon="location-o" text="地址管理" />
        <van-grid-item icon="peer-pay" text="支付安全" />
        <van-grid-item icon="hot-o" text="帮助与客服" />
        <van-grid-item icon="cash-o" text="意见反馈" />
        <van-grid-item icon="vip-card-o" text="我的竞拍" />
      </van-grid>
    </div>

    <!-- 退出功能 -->

    <van-button type="default" block @click="Logout"> 退出登录 </van-button>
    <template>
      <div>
        <van-dialog
          v-model="show"
          title="提示"
          message="确定要删除吗？"
          show-confirm-button
          show-cancel-button
        />
      </div>
    </template>
  </div>
</template>

<script lang="ts" setup>
import { reqLogout } from '@/api/user'
import router from '@/router'
import { clearStorage } from '@/utils/storage'
import { showConfirmDialog } from 'vant'
import { ref } from 'vue'

const show = ref(false)

// 退出登录
const Logout = () => {
  showConfirmDialog({
    title: '退出登录',
    message: '确定退出登录吗'
  })
    .then(async () => {
      // on confirm
      // console.log('确定')
      const res = await reqLogout()
      if (res.code === 200) {
        router.push('/home')
        clearStorage()
      }
    })
    .catch(() => {
      // on cancel
      console.log('取消')
    })
}
</script>

<script lang="ts">
export default {
  name: 'YesLogin'
}
</script>

<style lang="less" scoped>
.All {
  height: 24.5rem;
  background-color: #eee;
  .header {
    height: 3.6rem;
    position: relative;
    img {
      width: 100%;
      height: 3.6rem;
      position: absolute;
    }
    .van-row {
      position: absolute;
      height: 135px;
      width: 375px;
      .uInfo {
        display: flex;
        height: 135px;
        // justify-content: flex-start;
        // align-content: center;
        .profile {
          align-self: center;
          margin-left: 20px;
          height: 135px;
          width: 71px;
          line-height: 135px;
          img {
            margin-top: 0.7rem;
            width: 71px;
            height: 71px;
            border-radius: 50%;
          }
        }
        .info {
          // height: 135px;
          margin-left: 10px;
          align-self: center;
          color: #ffffff;
          .nickname {
            font-size: 18px;
          }
          .level {
            font-size: 16px;
          }
        }
      }
    }
  }
  .money {
    background-color: #ffffff;
    p:first-of-type {
      font-size: 0.4rem;
      margin-left: 20px;
      line-height: 1.3rem;
      border-bottom: 1px solid #eee;
    }
    ul {
      display: flex;
      justify-content: space-evenly;
      height: 2rem;
      li {
        font-size: 0.4rem;
        font-weight: normal;
        span {
          display: block;
          text-align: center;
          font-weight: bold;
          line-height: 1rem;
        }
      }
    }
  }
  .grid {
    background-color: #ffffff;
    margin-top: 0.25rem;
    .van-grid-item {
      height: 2.73077rem;
    }
  }
  .wrapper {
    width: 300px;
    height: 200px;
  }
}
</style>
